//
//  Extensions.swift
//  hello
//
//  Created by 赵康 on 2024/11/11.
//

import Vapor

extension Request {
	var authenticatedUserID: UUID {
		get throws {
			guard
				let userID = session.data["userID"],
				let uuid = UUID(userID)
			else {
				throw Abort(.unauthorized, reason: "未登录")
			}
			return uuid
		}
	}
	// MARK: - Cache扩展
	var cache: Cache {
		.init(logger: logger)
	}
}
